//
//  YGAttendingDoctorTableViewCell.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/8.
//

#import "YGAttendingDoctorTableViewCell.h"
#import "YGDoctorMsgView.h"

@interface YGAttendingDoctorTableViewCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *detailLabel;
@property (nonatomic, strong) YGDoctorMsgView *doctorMsgView;



@end

@implementation YGAttendingDoctorTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
        [self initconstraints];
    }
    return self;
}

-(void)initView{
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.doctorMsgView];
    [self.contentView addSubview:self.detailLabel];
}

-(void)initconstraints{
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.contentView.mas_top).offset(20);
            make.left.mas_equalTo(self.contentView.mas_left).offset(10);
            make.width.mas_equalTo(120);
            make.height.mas_equalTo(15);
    }];
    
    [self.doctorMsgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(15);
            make.left.mas_equalTo(self.contentView.mas_left).offset(10);
            make.right.mas_equalTo(self.contentView.mas_right).offset(-10);
            make.height.mas_equalTo(140);
    }];
    
    [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-12);
            make.left.mas_equalTo(self.contentView.mas_left).offset(10);
            make.right.mas_equalTo(self.contentView.mas_right).offset(-10);
            make.height.mas_equalTo(60);
    }];
}

- (void)configureDataWith:(YGDoctorMessageModel *)model{
    if (model) {
        [self.doctorMsgView updateDoctorMsgWith:model];
    }
}

#pragma setter
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.text = @"我的主治医生";
        _titleLabel.font = [UIFont systemFontOfSize:15];
        _titleLabel.textColor = UIColorFromRGB(0x333333);
        
    }
    return _titleLabel;
}

- (YGDoctorMsgView *)doctorMsgView{
    if (!_doctorMsgView) {
        _doctorMsgView = [[YGDoctorMsgView alloc]init];
        _doctorMsgView.layer.borderWidth = 0.08;
        _doctorMsgView.layer.cornerRadius = 4;
        _doctorMsgView.clipsToBounds = YES;
    }
    return _doctorMsgView;
}

- (UILabel *)detailLabel{
    if (!_detailLabel) {
        _detailLabel = [[UILabel alloc]init];
        _detailLabel.text = @"咨询沟通仅限于临床营养方面内容的咨询解答，本交流平台不予以疾病判断，如需对具体病情问诊建议至医院挂号就诊，谢谢。";
        _detailLabel.font = [UIFont systemFontOfSize:15];
        _detailLabel.textColor = UIColorFromRGB(0x333333);
        _detailLabel.numberOfLines = 0;
    }
    return _detailLabel;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
